var express = require('express');
var router = new express.Router();
var Mock = require('mockjs')
/*var express=require('./data/express')*/


router.get('/list', function (req, res) {
  var express = Mock.mock({
    'list|5': [{
      name:'@cname',
      'phone':/\d{5,11}/,
      'expresscompany|1':[{
        name:'申通快递',
        count:6
      },{
        name:'圆通快递'
      },
        {
          name:'中通快递'
        },
        {
          name:'韵达快递'
        },
        {
          name:'顺丰快递'
        },
        {
          name:'邮政快递'
        },
      ],
      address:'@county(true)',
      number:'@integer(10000)',
      datetime:'@now'
    }]
  })
  /*var express=Mock.mock({
    'list|5':[{
      name:'@cname',
      'address|1':[{
        name:'',
        'phone':/\d{5,11}/,
        address:'@county(true)',
      }]
    }]
  })*/

  res.send(express.list);

})

var express=[];
router.get('/add',function (request,response) {
  console.log(request,response);
  express.unshift(request.query)
  response.send({
    exp:express,
    flag:true
  })
})


/*module.exports=express.add;
module.exports=express.list;*/
module.exports= router;
